Repository navigation
doc-check: symlinks through folders, untouched symlink budgets, fences (#947) - #1020
Conversation
#947) - The removal scan walks each untouched symlink and link name by name on the base tree and the checkout, through folder symlinks, and runs when the change removes a path or changes a symlink. It blames only what resolved on the base and names the path the change removed or the symlink it changed; what already pointed to no file on the base (a loop too) stays unblamed. - --base also checks an untouched symlink whose target (or a symlink on the way) the change touched, under the symlink's own budget, as --all does. - Inline code starts only at a whole run of backticks. - A fence on a list item's own line ("- ```sh") opens a fence in the item. - Indented code (in a list item or at the margin, after a blank line) is skipped, as CommonMark reads it. - Reading the base tree fails closed (exit 2) when git fails. Fixes #947 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
lens: code · reviewer: lens agent · read at: 5966908 Examples for the major (each line in nope.md is a link in CommonMark): Untested here: nothing. These tests use no local socket and no jq. fork-ci-result on this head: success. 🤖 Generated with Claude Code |
Round 1 of the code review. A line that continues a list item's paragraph without indent (lazy) no longer ends the item, and in "- - item" each marker opens an item, so the item's next paragraph is never read as indented code. A lazy line opens nothing; an empty item or one numbered from 2 cannot interrupt a paragraph; "- - -" is a thematic break; indented code needs a blank line only after a paragraph. Tests: the reviewer's two cases and the variants found against commonmark.js, a deleted doc named ":(top)A.md" (GIT_LITERAL_PATHSPECS), and a test name that says only what it tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
not a lens: narrow check after fix round 1 Verdict: NOT SAFE. The reviewer's two cases and the whole lazy-line / nested-marker family are fixed at the root. But the new "can't interrupt a paragraph" guard also applies after a block-quote line, so a broken link that main and 5966908 both catch now passes. The fix is one line plus a test. Oracle: commonmark.js 0.31.2 (the reference parser), pinned in a scratch folder outside the repo, compared with 1. Major fixed at the root? Yes for what the review found, but there is one new miss (block quotes).
2. The opposite error (checking links that are really in code): much less than before, and nothing new that matters. On block-only docs, false alarms drop from about 1960 per 6000 (main) to 135-152. In the hand cases, the 10 that remain all happen on main too: 3. Keeping "indented code needs a blank line only after a paragraph" (doc_check.py:242, :262) instead of dropping minor 3: sound. This is the CommonMark rule (indented code cannot interrupt a paragraph, and nothing else stops it). The oracle agrees: heading, closing fence, 4. Tests. On this head, 5. fork-ci-result on 6ff6171: success (all checks finished, none failed). 🤖 Generated with Claude Code |
…e it The checker does not model block quotes, so a ">" line counted as a paragraph that the next line continues: "2." right below a quote was read as text and its indented content as code, which hid a broken link. Such a line goes on with the quote's paragraph only lazily, so it now opens what it would open outside the quote; an indented line after it stays lazy text. Found by the narrow check on #1020; commonmark.js 0.31.2 agrees. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The five follow-ups from the #942 reviews, in
fork-ci/actions/doc-check/. Each has a test that fails on main'sdoc_check.pyand passes here.What changed, per item
git ls-tree) and the checkout. It runs when the change deletes a path or changes a symlink (git diff --raw, mode 120000 on either side). It blames a symlink or link only if it resolved on the base, points to nothing now, and its base path went through something this change removed (this change removed real/A.md) or a symlink it changed (this change changed the symlink docs). This replaces the old spelling match, which only followed the symlink's own text. Newly caught:CLAUDE.md -> docs/A.mdwithdocs -> realwhenreal/A.mdis deleted orrealis renamed;docsretargeted to nothing or out of the repository, or removed; and the same cases through a doc link. If git fails while reading the base tree, the check exits 2 instead of passing.--base. An untouched selected symlink is checked when its target, or a symlink on its way, is part of the change, and it is judged under its own budget, as--alldoes. Example:CLAUDE.md -> AGENTS.md, where AGENTS.md grows to 61 lines, now fails both modes on CLAUDE.md's 40-line budget. As in--all, anything the target already reports is reported once, at the target. If the untouched symlink now points to nothing, it is left to the scan from item 1, so a symlink that was already dangling on the base is still not blamed.INLINE_CODEgets(?<!)`, so inline code starts only at a whole run of backticks. An unmatched run such as "close it with ``` and see g" no longer hides the link.- ```sh(also1.and10)) opens a fence at the item's content column. Before, its closing line opened a fence that hid the rest of the item.```block indented 4 past the item). The same rule applies at the margin (column 0), because CommonMark reads both the same way and one rule is simpler than two. Round 1 below makes list items follow CommonMark (lazy lines, several markers on a line), so a paragraph in an item is never read as code.README and the module docstring now say this.
State question: is a symlink judged the same by
--baseand--all?Yes, for every case the change causes.
SymlinkParityruns both modes on each case and checks that--baseprints the sameDOC CLAUDE.md: ...line as--all.CLAUDE.md -> X.md -> docs/A.md,docs -> real--all--basedocsretargeted to nothing or out of the repositorychanged the symlink docs)X.mddeleted, so the chain dangles)removed X.md)docs -> docs)changed the symlink docs)General vs project
.github/doc-check.jsonhere.--allon this repo prints byte-identical output before and after (687 files, 455 problems, the same lines), so the change adds no false failures.--base origin/mainreports 0 problems. A throwaway local branch that deleteddocs/fork/agent-rules.mdran the full scan in 0.6 s and reported its one remaining link.Checks run
python3 -I -B fork-ci/actions/doc-check/doc_check.test.py: 55 OK (53 before round 1). On main'sdoc_check.py, 19 of the new checks fail; the "removed half-way" and "already dangling" guards pass there too, as they should.vp run check:changed: format, typecheck and tests pass.jq.Round 1 (code review)
- - item- - -is a thematic break, not three items; indented code needs a blank line only after a paragraph (so a heading, closing fence or closed list followed by an indented line is code, and the line after it is read right).test_a_list_item_stays_open_on_a_lazy_line_and_every_marker_on_a_line_counts: the reviewer's two cases and the variants. 8 cases fail on 5966908.GIT_LITERAL_PATHSPECShad no testtest_a_deleted_doc_named_like_a_pathspec_magic_word: deleting:(top)A.mdthata.mdlinks to fails the check. It passes (wrongly) without the variable...._deleted.test_the_target_of_an_untouched_symlink_through_a_folder_symlink_deletedresolve()'s guards leaves all tests greenCommonMark comparison. Same method as the review:
link_linesagainst micromark 4.0.0, and also against commonmark.js 0.31.2 (the reference parser), each pinned in a scratch folder. Two seeds of 6000 random block-only docs (list markers, nested markers, lazy lines, indents, tabs, fences, headings, thematic breaks). The docs come from a different generator than the review's, so the counts don't compare with its numbers.Every micromark miss on this head is a doc where micromark and commonmark.js disagree. The case is
codefollowed by2) foo. micromark reads2) fooas paragraph text; commonmark.js, like the spec, reads it as a list (the numbered-from-2 rule only applies when the line before is paragraph text). The 4-5 links still checked inside code are fail-closed only: a setext===underline, and tabs inside list items, which are counted as 4 columns rather than to the next tab stop.Left
resolve()'s guards (absolute target,..past the root, a file used as a folder) have no test: dropped. In every case the review built, the walk ends in "no such path" either way, so no test can tell them apart.Fixes #947
After the narrow check (4e85c93)
2.item right below a>line was read as paragraph text and its indented content as code, so a broken link there passed (narrow check, comment 7085651329)test_a_block_quote_line_is_no_paragraph_the_next_line_goes_on: red before the fix (1 failure), 56 OK after;--alloutput byte-identical before and after on this repo🤖 Generated with Claude Code